package com.xgk.boot.module.core.dal.mapper.truck;

import com.xgk.boot.framework.common.pojo.PageResult;
import com.xgk.boot.framework.mybatis.core.mapper.BaseMapperX;
import com.xgk.boot.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.xgk.boot.module.core.controller.admin.truck.vo.ApiLogPageReqVO;
import com.xgk.boot.module.core.controller.admin.truck.vo.OrderLogPageReqVO;
import com.xgk.boot.module.core.dal.entity.truck.TruckOrderApiLogDO;
import com.xgk.boot.module.core.dal.entity.truck.TruckOrderLogDO;
import org.apache.ibatis.annotations.Mapper;

import java.time.Instant;
import java.time.LocalDateTime;

/**
 * 订单操作日志 Mapper接口
 */
@Mapper
public interface TruckOrderLogMapper extends BaseMapperX<TruckOrderLogDO> {
  

    default PageResult<TruckOrderLogDO> selectPage(OrderLogPageReqVO pageReqVO) {
        return selectPage(pageReqVO, new LambdaQueryWrapperX<TruckOrderLogDO>()
                .eqIfPresent(TruckOrderLogDO::getCreator, pageReqVO.getUserId())
                .eqIfPresent(TruckOrderLogDO::getOrderCode, pageReqVO.getOrderCode())
                .betweenIfPresent(TruckOrderLogDO::getCreateTime,new Instant[]{pageReqVO.getStartTime(),pageReqVO.getEndTime()})
                .orderByDesc(TruckOrderLogDO::getCreateTime));
    }
}